﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DLMemberPointMS.Business;
using DLMemberPointMS.Entity.ViewModel;

namespace DLMemberPointMS.Web.Controllers
{
    public class UsersController : Controller
    {
        private readonly UsersService _usersService = new UsersService();
        // GET: Users
        /// <summary>
        /// 显示用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult ShowUserInfo(int id)
        {
            var viewmod = _usersService.ShowUserInfo(id).data;
            return View(viewmod);
        }
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="mod"></param>
        /// <returns></returns>
        public ActionResult ChangeUserInfo(UsersViewModel mod)
        {
            var res = _usersService.ChangeInfo(mod);
            return Json(res);
        }
        /// <summary>
        /// 显示修改密码视图
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowChangePwd(int id)
        {
            ViewBag.ID = id;
            return View();
        }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="mod"></param>
        /// <returns></returns>
        public ActionResult ChangePwd(UsersViewModel mod)
        {
            var res = _usersService.ChangePwd(mod);
            return Json(res);
        }
    }
}